]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
signalTracker: Use connect_after to track 'destroy'
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 4 Mar 2022 22:34:59 +0000 (23:34 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sat, 5 Mar 2022 00:12:27 +0000 (00:12 +0000)
The 'destroy' signal currently doesn't work with connectObject(),
because the handler is only connected after the signal tracker's
own destroy handler, which disconnects all handlers.

Address this by using connect_after for the cleanup handler, so
that other destroy handlers run before it (unless they also use
ConnectFlags.AFTER, but well *shrug*).

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2221>

js/misc/signalTracker.js

index 9366814756fb587216869bd01e35757cfa03e315..b7aff10dc8c8b85e04a706cbdb722e58080b4219 100644 (file)
@@ -32,7 +32,7 @@ class SignalTracker {
      */
     constructor(owner) {
         if (this._hasDestroySignal(owner))
-            this._ownerDestroyId = owner.connect('destroy', () => this.clear());
+            this._ownerDestroyId = owner.connect_after('destroy', () => this.clear());
 
         this._owner = owner;
         this._map = new Map();
@@ -73,7 +73,7 @@ class SignalTracker {
         const signalData = this._getSignalData(obj);
         if (signalData.destroyId)
             return;
-        signalData.destroyId = obj.connect('destroy', () => this.untrack(obj));
+        signalData.destroyId = obj.connect_after('destroy', () => this.untrack(obj));
     }
 
     _disconnectSignal(obj, id) {